package strings;

/**
 * Created by Tzachi on 14/10/2014.
 */
public class ReverseSingleWord {
    public static char[] reverse(char[] input) {
        int size = 0;
        for (char c : input) {
            if ('#' != c) size++;
        }
        size--;
        for (int i = 0; i <= size / 2; i++) {
            char tmp = input[i];
            input[i] = input[size - i];
            input[size - i] = tmp;
        }
        return input;
    }


    public static void main(String[] args) {
        System.out.println(reverse(new char[]{'a', 'b', 'c', 'd', '#'}));
    }
}
